<script type="text/javascript">
 function checkLogin()
 {
     alert('您还没有登陆');
     return false;
 }
  function checknon()
 {
     alert('该教师暂无视频');
     return false;
 }
</script>
<div id="indexcates">
         <?php
                global $db;
                $coursewareid = $_GET['coursewareid'];
                $teacherid = $_GET['teacherid'];
                $sql_courseware_index = "select * from nettteach_courseware  where writerid ='".$teacherid."' and state ='0' and id = ".$coursewareid."  ";
                $sql_courseware = "select * from nettteach_courseware  where writerid ='".$teacherid."' and state ='0' and id <> (".$coursewareid.") order by times desc ";
                $result_courseware = $db -> query($sql_courseware);
                $result_courseware_index = $db -> query($sql_courseware_index);
                $row_index = $db ->fetch_array($result_courseware_index);
                $recordcount = $db -> num_rows($result_courseware);
                @$page=$_GET['p'];
                if ($page==null){$page=1;}
                $pagesize=15;								//每页显示数
                $pagecount=ceil(($recordcount+1)/$pagesize);	//计算总页
                if ($page>$pagecount){$page=$pagecount;}
                if ($page<1){$page=1;}
                 $i=($page-1)*($pagesize);
                 $i++;
        ?>
        <div class="row-fluid" >
            <ul class="breadcrumb">
                <li><?php echo (fs_get_objinfo(nettteach_member, id, $teacherid, realname))?> &nbsp;教师课件 </li>
            </ul>
        </div>	
        
    <div align="left" style="line-height: 35px;">
      <table border="0" cellpadding="0" cellspacing="0" class="breadcrumb" align="center" width="100%">
        <tr align="center">
          <td style="line-height:2em;" nowrap>序号</td>
          <td nowrap>课件标题</td>
          <td nowrap>课件简介</td>
	  <td nowrap>发布时间</td>
          <td nowrap>下载次数</td>
          <td nowrap>操 作</td>
        </tr>
        <tr>
		<td height=1 colspan=10 bgcolor="#E8F1FF" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='E7sxE7sxE7sx'"></td>
	</tr>
    <?php if($page==1){?>
    <tr style="color: red"  onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='FFFFFF'"  align="center">
			<td style="line-height:2em;"><?php echo ($i)?> </td>
                        <td><?php echo ($row_index['title'])?> </td>
                        <td title="<?php echo ($row_index['introduction'])?> "><?php echo (sub_str($row_index['introduction'],20))?> </td>
                        <td><?php echo date('Y-m-d',$row_index['intotime'])?> </td>
			<td><?php echo ($row_index['times'])?> </td>
			<td><a <?php if($_SESSION['sid']==''){echo 'href="#" onclick="checkLogin()"';}else{echo 'href="?do=showcoursewareinfo&courseware_id='.$row_index["id"].'&teacherid='.$teacherid.'"';}?>>查看</a></td>
		</tr>
		<tr>
			<td height=1 colspan=10 bgcolor="#E8F1FF" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='E7sxE7sxE7sx'"></td>
		</tr>
        <?php }?>
<?php
    if($page==1){
        $pagesize=$pagesize-1;
        $courseware_result=$db->query($sql_courseware." limit ".($page-1)*($pagesize).",$pagesize");
    }else{
        $courseware_result=$db->query($sql_courseware." limit ".(($page-1)*$pagesize-1).",$pagesize");
    }
    if($page !=1){
        $i=$i-1;
    }
	while($courseware_row = $db->fetch_array($courseware_result))
	{ 
                    $i++;

                
?>
		<tr   onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='FFFFFF'"  align="center">
			<td style="line-height:2em;"><?php echo ($i)?> </td>
                        <td><?php echo ($courseware_row['title'])?> </td>
                        <td title="<?php echo ($courseware_row['introduction'])?> "><?php echo (sub_str($courseware_row['introduction'],20))?> </td>
                        <td><?php echo date('Y-m-d',$courseware_row['intotime'])?> </td>
			<td><?php echo ($courseware_row['times'])?> </td>
			<td><a <?php if($_SESSION['sid']==''){echo 'href="#" onclick="checkLogin()"';}else{echo 'href="?do=showcoursewareinfo&courseware_id='.$courseware_row["id"].'&teacherid='.$teacherid.'"';}?>>查看</a></td>
		</tr>
		<tr>
			<td height=1 colspan=10 bgcolor="#E8F1FF" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='E7sxE7sxE7sx'"></td>
		</tr>
<?php
	}
?>
	</table>
	
	
	
</div>
<div align="center" >
<?php
/*分页示例:

pager(传入URL , 数据总数 , 开始条数 , 每页数目)
*/
if($page==1){
echo(pager('?do=leftcourseware&p={page}&coursewareid='.$coursewareid.'&teacherid='.$teacherid,$recordcount+1,($page-1)*($pagesize),$pagesize+1));	
}else{
    echo(pager('?do=leftcourseware&p={page}&coursewareid='.$coursewareid.'&teacherid='.$teacherid,$recordcount+1,($page-1)*($pagesize),$pagesize));	
}
?>
</div>

	</td>
</div>
    
